public class Main {
    public static void main(String[] args) {
        int count = 0; 
        for (int num = 2; num <= 20000; num++) {
            if (isPrime(num)) {
                System.out.print(num + "\t"); 
                count++;
                if (count % 5 == 0) {
                    System.out.println();
                }
            }
        }
    }

    
    public static boolean isPrime(int number) {
        if (number <= 1) {
            return false;
        }
        for (int i = 2; i <= Math.sqrt(number); i++) {
            if (number % i == 0) {
                return false; 
            }
        }
        return true; 
    }
}